<template>
  <div class="my-box">
    <span>子组件看到的注入操作：</span>
  </div>
</template>
<script lang="ts" setup>
import { inject } from 'vue'

// 注入
const provideState: any = inject('provideState')

//子组件触发name 改变
provideState.changeName()

// 子组件拿值
console.log('儿子拿的' + provideState.name.value)
</script>

<style scoped>
.my-box {
  display: flex;
}
/* 支持CSS变量注入v-bind(color) */
</style>
